<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 
  - Author(s): Administrator
  - Date: 2018-03-22 20:42:07
  - Description:
-->
<head>
<title>部门选择控件</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <%@include file="/common/common.jsp" %>
    <style type="text/css">
    	.form-control{
    		  width: 13%;
    		  float: left;
    		  height: 28px;
    		  margin-top: 6px;
    	}
    	.span1{
    		  float: left;
    		  padding-top:11px;
    	}
    	.span-name{
    		padding-left: 20%;
    	}
    	.span-oddnum{
    		margin-left: 13px;
    	}
    	
    	.layui-table-cell{
    		text-align: center;
    	}
    	#content-data{
    		height:393px; 
    		width:420px;
    		overflow-x:auto; 
    		float: left;
    		border-top: 1px solid #e6e6e6;
    		border-bottom: 1px solid #e6e6e6; 
    	} 
    	.layui-tree li{
    		overflow: inherit;
    	} 
    	 
    	.btn-query{
    		width: 70px;
    		height: 29px;
    		padding-top: 3px;
    		margin-left: 6px;
    	}
    	.btn-ok{
    		width: 70px;
    		height: 29px;
    		padding-top: 3px;  
    		margin-left: 50%;   
    	}
    	.btn-cancel{
    		width: 70px;
    		height: 29px;
    		padding-top: 3px;  
    		margin-left: 6px;
    	}
    </style>
</head>
<body>
	<div id="content-data"> 
		<ul id="demo1" class="demo1"></ul>
	</div>


<div>
	<!-- <button type="button" onclick="" class="btn btn-primary btn-ok" data-type="SelectedEmp"  data-complete-text="Loading finished">确认</button>
	<button type="button" onclick="" class="btn btn-primary btn-cancel"  data-complete-text="Loading finished">取消</button> -->
</div>
	<script type="text/javascript">
   var list="[]";	
   var  jsonList = JSON.parse(list);
  layui.use('table', function(){
  var table = layui.table;
  
});
   	
    $(function() {
     $.ajax({
           url: 'org.gocom.components.coframe.tools.departmentPlugIn.selectL2.biz.ext',
				type:'POST',
				cache: false,
				success:function(data){
				
					layui.use(['tree', 'layer'], function(){
					  var layer = layui.layer
					  ,$ = layui.jquery; 
					 
					  layui.tree({
					    elem: '#demo1' //指定元素
					    ,skin: 'red'
					    ,target: '_blank' //是否新选项卡打开（比如节点返回href才有效）
					    ,click: function(item){ //点击节点回调
					    var all=item.l1name;
					    if(item.l2name!=null){
					    	all+="/"+item.l2name;
					    }
					    if(item.l3name!=null){
					    	all+="/"+item.l3name;
					    }
					    if(item.l4name!=null){
					    	all+="/"+item.l4name;
					    }
					    
					    var json={
					         "L1name" : item.l1name,
					         "L1id" : item.l1,
					         "L2name" : item.l2name,
					         "L2id" : item.l2,
					         "L3name" : item.l3name,
					         "L3id" : item.l3,
					         "L4name" : item.l4name,
					         "L4id" : item.l4,
					         "alias":item.alias,
					         "aliasName":all
					     };
					    jsonList.splice(0,jsonList.length); 
					    jsonList.push(json);
					    
					    
					    }
					    ,nodes:data.orgorganizantion
					  });
		  });
				
				}
			});
			
			
	$("body").on("mousedown",".layui-tree a cite",function(){ 
		$(".layui-tree a cite").css('background','');
		$(".layui-tree a cite").css('border-style',''); 
		$(".layui-tree a cite").css('border-color',''); 
		$(".layui-tree a cite").css('border-width','');  
		$(this).css('background','#f0ce9f'); 
		$(this).css('border-style','solid');
		$(this).css('border-color','#E3E3E3');
		$(this).css('border-width','1px');
		}); 	
    });
    
   
    
    function selectName(){
    	showName($("#empId").val(),$("#empName").val(),"");
    }
    function getData(){
        return jsonList;
    }
    </script>
</body>
</html>